package com.wx.soft.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
 * Created by king-pc on 2018/11/28.
 */
@Configuration
@Controller
public class WebConfig extends WebMvcConfigurerAdapter {

    /**
     * 系统默认打开页面
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("forward:/defaultLogin");
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
        super.addViewControllers(registry);
    }

    /**
     * 默认首页
     * @return
     */
    @GetMapping("/defaultLogin")
    public String defaultLogin(){
        return "/login";
    }


}
